/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.edu.cs576.HyperLinkVideo.authoringtool;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

/**
 *
 * @author Ludo
 */
public class HyperlinkListHandler implements ListSelectionListener{
    private AuthoringToolGUI gui;
    
    public HyperlinkListHandler(AuthoringToolGUI gui){
        this.gui = gui;
    }

    @Override
    public void valueChanged(ListSelectionEvent e) {
        JList list = (JList)e.getSource();
        int index = list.getSelectedIndex();
        if(index >= 0){
            updateKeyFrameList(index);
            updateLinkVideo(index);
        }
    }
    
    private void updateKeyFrameList(int index){
        gui.updateKeyFrameList(index);
    }
    
    private void updateLinkVideo(int hyperlinkInd){
        gui.updateLinkVideo(hyperlinkInd);
    }
    
}
